﻿using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Web.Mvc;
using Orchard.ContentManagement;

namespace NGrid.Models
{
    public class NGridPart : ContentPart<NGridRecord>
    {
        public bool EnablePaging 
        {
            get { return Record.EnablePaging; }
            set { Record.EnablePaging = value; }
        }

        public bool EnableSorting
        {
            get { return Record.EnableSorting; }
            set { Record.EnableSorting = value; }
        }

        [Required, DisplayName("Table Name to Display")]
        public string TargetTableName
        {
            get { return Record.TargetTableName; }
            set { Record.TargetTableName = value; }
        }

        public int? PageSize { get; set; }

        public IEnumerable<SelectListItem> PagePossibleSizes
        {
            get 
            {
                var collection = new List<SelectListItem>();
                collection.Add(new SelectListItem {Value = "10"});
                collection.Add(new SelectListItem {Value = "25"});
                collection.Add(new SelectListItem {Value = "50"});
                collection.Add(new SelectListItem {Value = "100"});

                return collection;
            }
        }
    }
}